package com.liruo.learn.spring.mvc.controller.valid;

import com.liruo.learn.spring.mvc.controller.valid.group.Add;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.groups.Default;

/**
 * @Author:liruo
 * @Date:2023-05-08-21:32:56
 * @Desc
 */
@RestController
@Slf4j
@RequestMapping("/validated")
public class ValidatedBeanController {
    /**
     * @    @Validated才能使用分组功能, @Valid不能
     */
    @GetMapping("/bean")
    public void bean(@Validated({Add.class, Default.class})  ValidBean validBean){
        log.info("bean {}", validBean);
    }
}

